Skip to content

Migrate stream APIs from rmm::cuda_stream_view to cuda::stream_ref - #2521

Open
bdice wants to merge 6 commits into
NVIDIA:mainfrom
bdice:cuda-stream-ref
Open

Migrate stream APIs from rmm::cuda_stream_view to cuda::stream_ref#2521
bdice wants to merge 6 commits into
NVIDIA:mainfrom
bdice:cuda-stream-ref

Conversation

@bdice

@bdice bdice commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

Summary

Track the coordinated migration of stream APIs and call sites from rmm::cuda_stream_view to CCCL's cuda::stream_ref. This propagates cuda::stream_ref through RMM containers and memory resources, RAFT resource and handle APIs, downstream C++ interfaces, Python/Cython bindings, benchmarks, tests, and documentation.

This migrates affected cuVS API signatures and internal call sites while extracting raw stream handles only where CUDA, generated/JIT, or legacy APIs require them.

Depends on rapidsai/rmm#2372 and NVIDIA/raft#3129.

Tracked in rapidsai/build-planning#318.

Migrations

  • Pass cuda::stream_ref through stream pools, resource accessors, conditionals, and downstream APIs without converting to rmm::cuda_stream_view
  • Use cuda::stream_ref constructions for default/legacy/per-thread streams
    • rmm::cuda_stream_default ➡️ cuda::stream_ref{cudaStream_t{cudaStreamDefault}}
    • rmm::cuda_stream_legacy ➡️ cuda::stream_ref{cudaStreamLegacy}
    • rmm::cuda_stream_per_thread ➡️ cuda::stream_ref{cudaStreamPerThread}
  • Use .get() when calling an API that requires a raw cudaStream_t, including CUDA runtime, library, CUB, and legacy API boundaries (previously rmm::cuda_stream_view used value())
  • Use .sync() when synchronizing a cuda::stream_ref (previously rmm::cuda_stream_view used synchronize())
  • Update Cython declarations and call sites to pass stream references directly where supported

@copy-pr-bot

copy-pr-bot Bot commented Aug 28, 2026

Copy link
Copy Markdown

Auto-sync is disabled for draft pull requests in this repository. Workflows must be run manually.

Contributors can view more details about this message here.

@bdice bdice changed the title Adapt pooled stream use to cuda::stream_ref Migrate stream APIs from rmm::cuda_stream_view to cuda::stream_ref Sep 2, 2026
@bdice
bdice marked this pull request as ready for review September 2, 2026 22:55
@bdice
bdice requested review from a team as code owners September 2, 2026 22:55
@bdice bdice added breaking Introduces a breaking change improvement Improves an existing functionality labels Sep 3, 2026
@tarang-jain

Copy link
Copy Markdown
Contributor

@bdice can you review #2526 to ensure I am not contradicting what you are doing here (a cmake review is also required there)

@bdice

bdice commented Sep 5, 2026

Copy link
Copy Markdown
Contributor Author

Rebased onto preparation PR #2557 and validated against the rebased RMM/RAFT stack. Local build-cuvs -j0 completed successfully, and the focused IVF-PQ test passed. CI is rerunning at 35c0411f.

@bdice

bdice commented Sep 6, 2026

Copy link
Copy Markdown
Contributor Author

Follow-up audit found two RAFT_CHECK_CUDA sites whose synchronization arguments were hidden by release-mode macro expansion. Commit b385713 now extracts the native handle with .get() in Vamana and IVF-PQ.

Validation:

  • build-cuvs -j0 passes against the local migrated RMM/RAFT stack.
  • IvfPq/f32_f32_i64.build_host_input_search/0 passes with recall 0.882324.
  • The focused Vamana test reaches the existing KvikIO CUDA_ERROR_ILLEGAL_ADDRESS failure at posix_io.hpp:257, consistent with the previously classified environment/test failure.

@bdice

bdice commented Sep 6, 2026

Copy link
Copy Markdown
Contributor Author

Stack correction: the two compatibility-accessor changes from the prior comment are independently buildable, so they now live in preparation PR #2557 as commit 62aaa35. This migration branch was rebased onto that preparation head and is now c262440. Its source tree is byte-for-byte identical to the previously validated migration tree.

@bdice

bdice commented Sep 6, 2026

Copy link
Copy Markdown
Contributor Author

Final parsimony audit found a duplicated list_sizes_ initialization introduced in ivf_sq_index.cpp. Migration head 0aee5249 removes the duplicate.

Validation passed with build-cuvs -j0; focused IvfPq/f32_f32_i64.build_host_input_search/0 passed with recall 0.881866.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

breaking Introduces a breaking change improvement Improves an existing functionality

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants